<template>
  <div class="u-p-20">
    <el-card shadow="never">
      <div slot="header">
        <b class="u-f-16">
          <span v-if="objForm.id">编辑</span>
          <span v-else>添加</span>渠道商
        </b>
        <div class="u-right u-5mt">
          <el-button
            type="success"
            size="small"
            icon="el-icon-document-checked"
            @click="submitForm('objForm')"
            v-if="hasPerm('businessEdit')"
            >提交保存</el-button
          >
          <el-button size="small" icon="el-icon-back" @click="$router.go(-1)"
            >返回</el-button
          >
        </div>
      </div>
      <el-form
        :model="objForm"
        :rules="rules"
        ref="objForm"
        label-width="100px"
        class="u-form"
      >
        <el-form-item label="门脸照">
          <el-image
            style="max-height: 90px; max-width: 90px"
            :src="objForm.storefront"
            :data-src="objForm.storefront"
            fit="cover"
            lazy
          ></el-image>
        </el-form-item>
        <el-form-item label="名称">
          <el-input type="text" v-model="objForm.name"></el-input>
        </el-form-item>
        <el-form-item label="联系人">
          <el-input type="text" v-model="objForm.contact_name"></el-input>
        </el-form-item>
        <el-form-item label="联系电话">
          <el-input type="text" v-model="objForm.contact_phone"></el-input>
        </el-form-item>
        <el-form-item label="公司地址">
          <el-input type="text" v-model="objForm.address"></el-input>
        </el-form-item>
        <el-form-item label="备注信息">
          <el-input type="text" v-model="objForm.check_info"></el-input>
        </el-form-item>
        <el-form-item label="审核状态">
          <el-radio v-model="objForm.check_status" :label="0">未审核</el-radio>
          <el-radio v-model="objForm.check_status" :label="1"
            >审核通过</el-radio
          >
          <el-radio v-model="objForm.check_status" :label="2"
            >审核失败</el-radio
          >
        </el-form-item>
      </el-form>
    </el-card>
  </div>
</template>

<script>
import commonEdit from "@/mixins/common-edit";
export default {
  mixins: [commonEdit],
  data() {
    return {
      apiName: "business",
      backRoute: "businessIndex", //成功跳转地址
      objForm: {
        id: "",
        name: "", //名称
        contact_name: "", //联系人
        contact_phone: "", //联系电话
        storefront: "", //门脸照
        address: "", //地址
        check_info: "", //备注
        check_status: 0, //状态
      },
    };
  },
  methods: {
    afterGetInfo() {
      //初始化-获取编辑数据
    },
  },
  created() {
    if (this.$route.params.id) {
      this.objForm.id = this.$route.params.id;
    }
  },
};
</script>
